This invention relates to the field of database searching, and in particular to a method and system for increasing the efficiency of database searches.
As technologies advance, the amount of information that is being stored in electronic form is ever increasing. Correspondingly, the search for particular information becomes increasingly more time consuming.
Database management systems (dbms) are designed to organize data in a form that facilitates efficient search and retrieval of select information. A typical database includes a plurality of “Tables”; each row of the table corresponds to a “Record”; and each column of the table corresponds to an attribute or parameter of each record. For example, a personnel database may include a table of employee addresses. The columns of the table may include a name, employee ID, street address, city, state, zip code. Each employee's record corresponds to a row in the table with employee-specific data in each column. Typical database management systems allow a user to submit a ‘query’ for finding and retrieving information that satisfies the query. Although a natural language interpreter may be the goal for developers of database management systems, users are required to use a ‘query language’ to submit such queries. Often, the query is one of a sequence of queries that are sequentially applied, with each query providing an increasingly finer filter for finding the desired information.
An example basic query may take the form of “Select name from tableA”, which will return all of the names in the identified table. A more complex form of a query may be in the form of “Select names from tableA, where names begin with ‘M’”, which will return all of the names in the identified table that begin with M. Even more complex forms of a query may be in the form of “Select from tableA, all names that are also in tableB”, “Select from tableA, all names with corresponding addresses having a zipcode that is also in tableB”, and so on. As can well be imagined, even with the single query operation “Select”, there may be hundreds or thousands of variations of the structure of the command, with potentially an infinite number of particular arguments.
Due to the myriad forms of the queries that a user may submit, in a typical database management system, a query language interpreter parses each query into a series of more primitive operations, commonly termed algebraic expressions, executes code to evaluate each algebraic expression, then presents the results to the user. Such interpretation, however, may consume a significant amount of time, and the sequential execution of the code for each algebraic expression may not be efficient in execution time or memory usage.
It would be advantageous to reduce the time consumed in the execution of a user's query, or sequence of queries. It would also be advantageous to optimize the use of resources in the execution of such queries.
These advantages, and others, can be realized by a system and method that preprocesses the user's queries to identify and extract the query parameters, create a skeletal query with reference to the extracted parameters, creates/compiles an executable version of the skeletal query, then executes the compiled version of the skeletal query using the particular parameters in the current query. The compiled version of the parameterized skeletal query is stored, and when another query is submitted that matches the skeletal query (but with potentially different parameters), the previously compiled skeleton query is executed with the parameters of this latter query.
Throughout the drawings, the same reference numerals indicate similar or corresponding features or functions. The drawings are included for illustrative purposes and are not intended to limit the scope of the invention.